<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="p" %>
<%String ctx = request.getContextPath(); %>

<jsp:include page="../common/operate.jsp">
	<jsp:param name="title1" value="基础数据"/>
	<jsp:param name="title2" value="公共信息列表"/>
</jsp:include>

<div style="width:100%" class="f_l margin1">
	<div id="search">
		<s:form id="searchForm" action="basicinfo!search" method="post" theme="simple">
		    <div align="right" style="width: 100%">
		        <s:text name="根据类型搜索:"/><select name="type" id="type" onchange="javascript:search();">
		            <option value="all" <s:if test="%{type == null}">selected="selected"</s:if>>全部</option>
		            <option value="0" <s:if test="%{type == 0}">selected="selected"</s:if>>功能</option>
		            <option value="1" <s:if test="%{type == 1}">selected="selected"</s:if>>剂型</option>
		            <option value="2" <s:if test="%{type == 2}">selected="selected"</s:if>>计量单位</option>
		        </select>
		    </div>
    	</s:form>
    </div>
    <s:form id="listForm" method="POST" theme="simple">
	    <table width="98%" cellspacing="0" cellpadding="0" border="0" class="clear f_l padding3" id="tb">
	      <tbody>
		      <tr class="bg4_nav">
		      	<td width="10px;" style="border:0">
		        	<input onclick="javascript:batchSelect(this)" type="checkbox" style="border:0" name="List_Selected2">
		        </td>
		        <td width="6%" class="t_c" style="border:0">序号</td>
		        <td class="t_c" style="border:0">名称</td>
		        <td class="t_c" style="border:0">类型</td>
		        <td class="t_c" style="border:0">内容</td>
		      </tr>
		      <s:iterator value="pager.result" status="status">
		      <tr>
		      	<td class="border_tb"><input type="checkbox" style="border:0" name="ids" value="${id }"></td>
		        <td class="border_tb">${status.index+1 }</td>
		        <td class="border_tb"><s:property value="name"/></td>
		        <td class="border_tb">
		          <s:if test="type==0">功能</s:if>
		          <s:if test="type==1">剂型</s:if>
		          <s:if test="type==2">计量单位</s:if>
		          <s:if test="type==3">信息类别</s:if>
		        </td>
		        <td class="border_tb"><s:property value="content"/></td>
		      </tr>
		      </s:iterator>
	      </tbody>
	    </table>
    </s:form>
    <div class="f_l margin1"><img src="<%=ctx%>/img/business/main_07.jpg"></div>
</div>

<div class="f_l margin1" style="width:100%">
  <p:page pager="${pager}" url="basicinfo!list.action" params="type=${type}" namespace="/basicinfo"/>
</div>
<script type="text/javascript">
function search(){
	var type = document.getElementById("type").value;
    if(type == "all"){
        window.location.href="basicinfo!list";
    }else{
    	window.location.href="basicinfo!list?type="+type;
    }
}
$(window).ready(function(){
	addOperate('addButton','<%=ctx%>/basicinfo/basicinfo!add');
	updateOperate('updateButton','<%=ctx%>/basicinfo/basicinfo!edit');
	batchDelete('deleteButton','listForm','<%=ctx%>/basicinfo/basicinfo!deleteAll');
	isAllSelected('listForm');	
});
</script>